﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PMisuseAn.behaviour.model
{
    [Serializable()]
    public class Group
    {
        int groupID_;
        string clusterName_;
        string groupName_;
        public List<Agent> members;
        public GroupType groupType;

        public Group()
        {
            members = new List<Agent>();
        }

        public int groupID
        {
            get
            {
                return groupID_;
            }
            set
            {
                groupID_ = value;                
            }
        }

        public string clusterName
        {
            get
            {
                return clusterName_;
            }
            set
            {
                clusterName_ = value;
            }
        }

        public string groupName
        {
            get
            {
                return groupName_;
            }
            set
            {
                groupName_ = value;
            }
        }

        public void addMember(Agent agent)
        {
            members.Add(agent);
        }

        public void removeAgent(Agent agent)
        {
            foreach (Agent a in members)
            {
                if (a.agentName.Equals(agent.agentName))
                {
                    members.Remove(a);
                    break;
                }
            }
        }

        public void removeAgent(string agentName)
        {
            foreach (Agent a in members)
            {
                if (a.agentName.Equals(agentName))
                {
                    members.Remove(a);
                    break;
                }
            }
        }

        public enum GroupType
        {
            Planned,
            Emergent
        };

    }
}
